package com.example.automanagement.mapper;

import com.example.automanagement.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Mapper
public interface UserMapper {
    User userLogin(@Param("loginUserId")String userId,@Param("loginUserPassword") String userPassword);

    List<UserRole> getUserRole(@Param("getUserRoleUserId") String userId) ;

    void addUser(@Param("userAdd") User user);

    void userUpdateInformation(@Param("user") User user);

    void userUpdatePassword(@Param("userId")String userId,@Param("oldPassword")String oldPassword,@Param("newPassword")String newPassword);

    void adminUpdateUser(@Param("adminUpdateUser") User user);

    void addUserRole(List<UserRole> userRoleList);

    void deleteUserRole(@Param("userId")String userId);

    void deleteUser(@Param("userIdDelete") String userId);

    List<RoleBusinessMenu> getRoleBusiness(@Param("BusinessUserRole")String userRole);

    List<Role> getAllRoles();

    List<RoleBusinessMenu> getOtherMenus(@Param("userRoleGetOthers") String userRole);

    void addRoleMenu(List<RoleBusiness> roleBusinessMenuList);

    void addRole(@Param("roleAdd") String roleName);

    void deleteRole(@Param("roleDelete") String roleName);

    void deleteRoleMenu(@Param("userRoleDelete")String userRole,@Param("businessIdDelete")int businessId);

    List<User> getAllUser();
    List<User> getUserInfoById(@Param("userId")String userId);

    @Select("select * from user where user_id = #{userId}")
    User getUserById(String userId);
}
